; https://discuss.ocaml.org/t/dune-how-to-link-statically-on-linux-not-on-others/8537/4?u=mro

(rule
 (with-stdout-to
  flags.sexp
  (run sh %{dep:gen_flags.sh})))

(rule
 (with-stdout-to
  version.ml
  ; (run echo "let dune_project_num = \"%{version:seppo}\"")
  (run sh %{dep:gen_version.sh} "%{version:seppo}" # ${build-number}) 
  ; https://github.com/ocaml/dune/issues/255#issuecomment-372077123
  ))

(rule
 (target res.ml)
 (deps
  (source_tree ../res))
 (action
  (with-stdout-to
   %{target}
   (run ocaml-crunch --mode=plain ../res))))

; https://stackoverflow.com/a/53325230/349514

(executable
 (public_name seppo)
 (package seppo)
 (name seppo_bin)
 (libraries seppo_lib unix)
 ; https://discuss.ocaml.org/t/lwt-ppx-binary-footprint/11818/2
 (preprocess
  (pps lwt_ppx))
 ; https://discuss.ocaml.org/t/ld-error-missing-note-gnu-stack-section/12478/4
 (flags
  -safe-string
  (:include flags.sexp)))

(documentation
 (package seppo))
